Prefer close backfill points (absolute distance)#19748
Merged
MadLittleMods merged 3 commits intoMay 15, 2026
Merged
Conversation
MadLittleMods
commented
May 1, 2026
| # | ||
| # This sorts ascending so 0 sorts before 1 | ||
| 0 if current_depth >= e.depth else 1, | ||
| ), |
Contributor
Author
There was a problem hiding this comment.
No tests but I sanity checked this sort with the snippet in the PR description
MadLittleMods
commented
May 1, 2026
| ) | ||
|
|
||
| # If we have no backfill points lower than the `current_depth` then either we | ||
| # If we have no backfill points lower than the `nearby_depth` then either we |
Contributor
Author
There was a problem hiding this comment.
Not exactly related to this PR but just a little correction since #19611 was merged. nearby_depth refers to the nearby_depth parameter we assemble above when calling get_backfill_points_in_room(...)
anoadragon453
approved these changes
May 15, 2026
anoadragon453
left a comment
Member
There was a problem hiding this comment.
Seems sane to me. Clever use of a tuple to tie-break the sorting!
Contributor
Author
|
Thanks for the review @anoadragon453 🐀 |
FrenchGithubUser
pushed a commit
to famedly/synapse-upstreaming
that referenced
this pull request
Jun 12, 2026
This isn't fixing any particular issue. It's just a follow-up I thought about after merging element-hq#19611 since we're now also dealing with backfill points in the nearby range ahead of the `current_depth`. And it's possible that the previous sort could bias to all nearby backfill points ahead of the `current_depth` that don't extend into the visible window of events we're paginating through.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prefer close backfill points (absolute distance)
This isn't fixing any particular issue. It's just a follow-up I thought about after merging #19611 since we're now also dealing with backfill points in the nearby range ahead of the
current_depth. And it's possible that the previous sort could bias to all nearby backfill points ahead of thecurrent_depththat don't extend into the visible window of events we're paginating through.Todo
Dev notes
Sort sanity check:
Pull Request Checklist
EventStoretoEventWorkerStore.".code blocks.